package com.lanzchina.lanclass.repository;


import com.lanzchina.lanclass.constant.Constant;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(url = Constant.GET_OPENID_URL, name = "getOpenId")
@Component
public interface OpenIdRepository {

    /**
     * 通过code获取openId和session_key
     * @param code 登录时获取的 code
     * @param appId 小程序唯一标识
     * @param secret 小程序的 app secret
     * @param grantType 填写为 authorization_code
     * @return openId和session_key
     */
    @GetMapping
    String getOpenid(@RequestParam("js_code") String code,
                     @RequestParam("appid") String appId,
                     @RequestParam("secret") String secret,
                     @RequestParam("grant_type") String grantType);
}
